<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
       /*  var fruit = prompt('请输入查找的水果')
        switch(fruit){
            case'榴莲':
                alert('十元每斤');
                break;
            case'苹果':
                alert('100元每斤');
                break;
            default:
                alert('不存在此水果');
        } */
        // 1.输入分数
        // 2.将分数除以10后存放在变量a之内
        // 3.switch判断
        /* var score = parseInt(prompt('请输入分数：')/10);
        switch(score){
            case 10:
            case 9:
                alert('A');
                break;
            case 8:
                alert('B');
                break;
            case 7:
                alert('C');
                break;
            case 6:
                alert('D');
                break;
            default:
                alert('E');
        } */
       /*  userName = prompt('请输入用户名：');
        passWord = prompt('请输入密码：');
        while ( userName != 'admin' || passWord != 123456) {
            alert('登录失败')
            userName = prompt('请输入用户名：');
            passWord = prompt('请输入密码：');
        }
        alert('登录成功'); */
        var cash = 100;
        do {
            var operate = Number(prompt('请输入你要的操作：\n'+'1.存钱\n'+'2.取钱\n'+'3.显示余额\n'+'4.退出\n'));
            switch (operate) {
                case 1:
                    var add = 0;
                    add = Number(prompt('请输入存的钱额：'));
                    cash += add;
                    break;
                case 2:
                    var reduce = 0;
                    reduce = Number(prompt('请输入取的钱额：'));
                    if (reduce > cash)
                    alert ('error');
                    else
                    cash -= reduce;
                    break;
                case 3:
                    alert('当前余额为：' + cash);
                    break;
                case 4:
                    alert('退出');
                    break;
                default:
                    break;
                }
        }while (operate != 4);
        // alert('退出');
    </script>
</head>
<body>
    
</body>
</html>